package ks.client.gui.user.listeners;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import ks.client.UserContext;
import ks.client.lobby.Lobby;
import ks.managers.icon.IconManager;
import ks.managers.user.User;
import ks.managers.user.UserManager;

public class getUserIconPic {

	Lobby lobby;
	JPanel panel;
	JLabel label;
	public getUserIconPic(Lobby lobby){
		this.lobby = lobby;
	}
	
	public void setIcon(){
		label = lobby.getAccountUpdateGUI().getPic();
		UserContext context = lobby.getUserContext();
		UserManager um = context.getUserManager();
		User u = um.getUser(context.getUser());
		
		IconManager im = context.getIconManager();
		//label.setText("Fdsfdsfds");
		if(im!=null){
		ImageIcon icon = new ImageIcon(im.getIcon(u.getIconName()).location);
		
		label.setIcon(icon);
		}
		//label = new JLabel(icon);

		
		//u.setIconName("bunny");
		//System.out.println
		//if(im.getIcon("bunny")!=null){
			
			//ImageIcon icon = new ImageIcon(im.getIcon("bunny").location);//im.getIcon(u.getIconName()).location);

			//label = new JLabel(icon);
			
			//panel.add(labe);
			//JButton button = new JButton(im.getIcon("bunny").name);
			//button.setIcon(icon);
			//panel.add(button);
			//lobby.getAccountUpdateGUI().refreshPanel();
		//}
		//panel.setBackground(new java.awt.Color(51, 0, 0));
	       
		
	}
}
